package sebastiankerckhof.scene;

import javax.swing.JFrame;

public class FieldOfView {
	public int near = 1, nx, ny;
	public long far = 10000;
	
	public float top, bottom, left, right;
	
	public FieldOfView(Scene c, JFrame frame){
		this(c.camera, frame);
	}
	public FieldOfView(Camera c, JFrame frame){
		this(c, frame.getWidth(), frame.getHeight());
	}
	public FieldOfView(Camera c, int nx, int ny){
		this(c.fovy, nx, ny);
	}
	public FieldOfView(float fovy, int nx, int ny){
		this.nx = nx;
		this.ny = ny;
		top = (float) Math.tan(Math.toRadians(fovy / 2));
		bottom = -top;
		right = -(nx/ny) * top;
		left = -right;
	}
	
	
	public String toString(){
		return "Top: "+top+", Bottom: "+bottom+", Left: "+left+", Right: "+right;
	}
}
